<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserEmployer extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        /**
         *
        `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
        `user_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '合作商id',
        `cooperative_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
        `avatar` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户头像',
        `credit_point` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '信誉分',
        `shop_point` int(11) NOT NULL DEFAULT 0 COMMENT '店铺分',
        `balance` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '余额',
        `status` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态：0禁用，1正常',
        `created_at` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '添加时间',
        `updated_at` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
         */
        Schema::create('user_employer', function (Blueprint $table) {
            $table->integerIncrements('id');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->unsignedInteger('cooperative_id')->default(0)->comment('合作商ID');
            $table->string('avatar')->default('')->comment('用户头像');
            $table->unsignedTinyInteger('credit_point')->default(0)->comment('信誉分');
            $table->unsignedInteger('shop_point')->default(0)->comment('店铺分');
            $table->unsignedDecimal('balance', 10, 2)->default(0.00)->comment('余额');
            $table->unsignedTinyInteger('status')->default(0)->comment('状态：0禁用，1正常');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_employer');
    }
}
